<template>
  <div class="detail-wrapper">
    <div class="detail-main">
      <div class="detail-box">
        <img class="detail-img" :src="datas?.files[0]?.url" />
        <div class="detail-info">
          <div class="detail-title">
            报修单-{{ datas?.equipment_name }}
          </div>
          <div class="detail-item">器材型号：{{ datas?.customer_equipment?.equipment_no }}</div>
          <div class="detail-item">器材编码：{{ datas?.customer_equipment?.equipment_no }}</div>
          <div class="detail-item">资产编号：{{ datas?.customer_equipment?.asset_no }}</div>
          <div class="detail-item">器材分类：{{ datas?.reqpir_category_name }}</div>
          <div class="detail-item">保修日期：{{ datas?.report_date }}</div>
        </div>
      </div>
      <div class="detail-timeline">
        <div class="detail-timeline-title">
          报修进度
        </div>
        <a-steps progress-dot :current="0" direction="vertical" :items="stepsItems"></a-steps>
      </div>
    </div>
  </div>
</template>
<script setup>
import { ref, computed, onMounted } from "vue";
import api from "@/api";
import { useRoute } from "vue-router";

const stepsItems = ref([

])
const route = useRoute();
const query = computed(() => route.query);
const datas = ref();
const getData = async () => {
  let params = {
    repair_id: query.value.id,
  };
  const res = await api.apiRepairFetchModelPost(params);
  datas.value = res.data;
};

const getStepData = async () => {
  let params = {
    repair_id: query.value.id,
  };
  const res = await api.apiRepairHistoryPagedListPost({args:params});
  console.log(111,res.data)
  stepsItems.value = res.data.data.map(item=>{
    return{
      title:item.created,
      description:(item?.user_real_name ? item?.user_real_name : '') +' '+(item?.title ? item?.title : '')
    }
  });
};

onMounted(async () => {
  await getData();
  await getStepData();
});
</script>

<style lang="less" scoped>
.detail-box {
  display: flex;
  padding-bottom: 10px;
  box-shadow: inset 0px -1px 0px 0px #E6EBF1;

  .detail-img {
    width: 128px;
    height: 128px;
    background: #D8D8D8;
    margin-right: 16px;
  }

  .detail-title {
    font-family: PingFangSC, PingFang SC;
    font-weight: 600;
    font-size: 16px;
    color: #333333;
    line-height: 30px;
    text-align: left;
    font-style: normal;
    margin-bottom: 6px;
  }

  .detail-item {
    font-family: PingFangSC, PingFang SC;
    font-weight: 400;
    font-size: 14px;
    color: #666666;
    line-height: 20px;
    text-align: left;
    font-style: normal;
    margin-bottom: 6px;
  }
}

.detail-timeline {
  padding: 20px 0px 0px 145px;

  .detail-timeline-title {
    font-family: PingFangSC, PingFang SC;
    font-weight: 600;
    font-size: 16px;
    color: #333333;
    line-height: 30px;
    text-align: left;
    font-style: normal;
    margin-bottom: 20px;
  }

  .detail-timeline-date {
    font-family: PingFangSC, PingFang SC;
    font-weight: 400;
    font-size: 14px;
    color: #8C8C8C;
    text-align: left;
    font-style: normal;
  }

  .detail-timeline-content {
    font-family: PingFangSC, PingFang SC;
    font-weight: 400;
    font-size: 14px;
    color: #262626;
    text-align: left;
    font-style: normal;
  }
}
</style>